package org.example.service.impl;

import org.example.datasource.TargetDataSource;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;

import org.example.domain.InsertUniqueTable;
import org.example.mapper.InsertUniqueTableMapper;
import org.example.service.IInsertUniqueTableService;
@Service
public class InsertUniqueTableServiceImpl implements IInsertUniqueTableService{

    @Autowired
    private InsertUniqueTableMapper insertUniqueTableMapper;

    @Override
    public int deleteByPrimaryKey(String smsId) {
        return insertUniqueTableMapper.deleteByPrimaryKey(smsId);
    }

    @Override
    public int insert(InsertUniqueTable record) {
        return insertUniqueTableMapper.insert(record);
    }

    @Override
    public int insertSelective(InsertUniqueTable record) {
        return insertUniqueTableMapper.insertSelective(record);
    }

    @Override
    @TargetDataSource("pgDataSource")
    public int testInsertUnique(String smsId) {
        InsertUniqueTable record = new InsertUniqueTable();
        record.setSmsId(smsId);
        int insert = insertUniqueTableMapper.insert(record);
        if(insert == 1){
            return 1;
        }
        return 0;
    }

}
